package generation.parts;

import generation.duration.QuantifiedCell;
import generation.scale.Scale;
import generation.transition.Transition;
import util.Utils;

public class Part {

	public static String generatePart(Scale scale,
			QuantifiedCell cell, Transition transition) {
		int noteQuatity = cell.getNoteQuantity();
		String[] durations = cell.getCell();
		String[] result = new String[noteQuatity];
		for (int i = 0; i < result.length; i++) {
			if(i == 0){
				result[i] = transition.firstStep(scale) + durations[i];
			} else {
				result[i] = transition.nextStep(result[i-1], scale) + durations[i];
			}
		}
		
		return Utils.getStringFromArray(result, " ");
	}
	
}
